#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>

using namespace std;
const int MAXN=8000+5;
int n,Q,mode,t1,t2;
//int ;
struct data{
	int ii,s;
}a[MAXN];
bool cmp(data a,data b){
	if(a.s!=b.s)return a.s<b.s;
	else return a.ii<b.ii;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&Q);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i].s);
		a[i].ii=i;
	}
	
	sort(a+1,a+1+n,cmp);
	
	for(int i=0;i<Q;++i){
		scanf("%d",&mode);
		if(mode==1){
			int g;
			scanf("%d%d",&t1,&t2);
			for(int j=1;j<=n;++j){
				if(a[j].ii==t1){
					g=j;
					break;
				}
			}
			a[g].s=t2;
			if(a[g].s<a[g-1].s)
				for(int j=g;j>1;--j){
					if(a[j].s<a[j-1].s||(a[j].s==a[j-1].s&&a[j].ii<a[j-1].ii)){
						swap(a[j].s,a[j-1].s);
						swap(a[j].ii,a[j-1].ii);
					}
				}
			if(a[g].s>a[g+1].s)
				for(int j=g;j<n;++j){
					if(a[j].s>a[j+1].s||(a[j].s==a[j+1].s&&a[j].ii>a[j+1].ii)){
						swap(a[j].s,a[j+1].s);
						swap(a[j].ii,a[j+1].ii);
					}
				}
		}
		else{
			scanf("%d",&t1);
			for(int j=1;j<=n;++j)
				if(a[j].ii==t1){
					printf("%d\n",j);
					break;
				}
		}
	}
	return 0;
}

